home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / asm32.zip / E32.ZIP / TOP.ASM < prev    next >
Assembly Source File  |  1994-12-28  |  1KB  |  43 lines

  1. ; TOP.ASM for E32 - Copyright (C) 1994 Douglas Herr
  2. ;  all rights reserved
  3.  
  4. include    model.inc
  5.  
  6. public    top
  7.  
  8. include    dataseg.inc
  9. extrn    dirty_bits:byte, left_margin:word, save_column:byte
  10. extrn    cursor:dword, top_of_screen:dword, cur_posn:word
  11. extrn    file_row:dword, first_row:byte, saved_pos:word
  12. extrn    display_mode:byte
  13. @curseg    ends
  14.  
  15. include    codeseg.inc
  16. ;
  17. ; This moves the cursor to the top of the file
  18. ;
  19. top    proc    near
  20.     xor    eax,eax
  21.     mov    cursor,eax    ; cursor to start of buffer
  22.     mov    top_of_screen,eax
  23.     mov    left_margin,ax    ; move to the far left margin
  24.     mov    save_column,al    ; save the cursor column
  25.     dec    eax
  26.     mov    saved_pos,ax    ; reset row,col on top line
  27.     neg    eax
  28.     mov    file_row,eax
  29.     or    dirty_bits,al    ; redraw the screen
  30.     dec    eax
  31.     add    ah,first_row
  32.     mov    al,display_mode
  33.     shr    al,2        ; AL = 1 if hex mode
  34.     dec    al        ; AL = 0 if hex mode
  35.     not    al        ; AL = 0FFh if hex mode
  36.     and    al,10        ; AL = 10 if hex mode, 0 if ASCII mode
  37.     mov    cur_posn,ax    ; home the cursor
  38.     ret
  39. top    endp
  40.  
  41. @curseg    ends
  42.     end
  43.